package main

import "fmt"

func main() {
	//ret := sum(3, 4)
	//ret := sum2(3, 4)
	//r1, r2, r3, r4 := Calc(3, 4)
	r1, r2, r3, r4 := Calc2(3, 4)
	fmt.Println(r1, r2, r3, r4)
}

/*一个返回值*/
func sum(a, b int) int {
	result := a + b
	return result
}

/*预定义返回值的名字*/
func sum2(a, b int) (he int) {
	he = a + b
	return
}

/*多个返回值*/
func Calc(a, b int) (int, int, int, int) {
	he := a + b
	cha := a - b
	ji := a * b
	shang := a / b
	return he, cha, ji, shang
}

/*多个返回值+预定义返回值名称*/
func Calc2(a, b int) (he int, cha int, ji int, shang int) {
	he = a + b
	cha = a - b
	ji = a * b
	shang = a / b
	return
}
